package com.example.endusation.controller;

import com.example.endusation.dto.AITalkDTO;
import com.example.endusation.dto.UserInfoDTO;
import com.example.endusation.rag.DiscreteMathRagService;
import com.example.endusation.service.DiscreteMathService;
import com.example.endusation.util.WrapperResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/core/web/talk")
public class DiscreteMathController {

    @Autowired
    private DiscreteMathService discreteMathService;
    @PostMapping("/talk")
    public WrapperResponse talk(@RequestBody AITalkDTO aiTalkDTO) {

        return discreteMathService.talk(aiTalkDTO);

    }

    @PostMapping("/queryDiaLogue")
    public WrapperResponse queryDialogue(@RequestBody AITalkDTO aiTalkDTO){
        return  discreteMathService.queryDialogue(aiTalkDTO);
    }

    @PostMapping("/queryDiaLogueDetil")
    public WrapperResponse queryDialogueDetil(@RequestBody AITalkDTO aiTalkDTO){
        return discreteMathService.queryDiaLogueDetil(aiTalkDTO);
    }
    @PostMapping("/insertDiaLogue")
    public WrapperResponse insertDialogueDetil(@RequestBody AITalkDTO aiTalkDTO){
        if(aiTalkDTO.getQuestion()==null){
            aiTalkDTO.setUsername("新的会话");
        }
        return discreteMathService.insertDiaLogue(aiTalkDTO);
    }

    @PostMapping("/uploadFile")
    public WrapperResponse uploadFile(AITalkDTO aiTalkDTO){
        return discreteMathService.uploadFile(aiTalkDTO);
    }
    @PostMapping("/talkWithFile")
    public WrapperResponse talkWithFile(@RequestBody AITalkDTO aiTalkDTO){
        return discreteMathService.talkWithFile(aiTalkDTO);
    }
}
